using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

//TERING 2
namespace Trigits
{
    /// <summary>
    /// This is a game component that implements IUpdateable.
    /// </summary>
    public class Player
    {
        private int number;
        private String name;
        private int score = 0;
        private int round = 0;
        private bool turn = false;
        private int countBoughtTriominoe = 0;
        private SlateContainer slate;

        public Player(int number, String name)
        {
            // TODO: Construct any child components here
            this.number = number;
            this.name = name;
        }
        public void setSlate(SlateContainer slate)
        {
            this.slate = slate;
            slate.setName(name);
            slate.setScore(score);
            slate.setRound(round);
        }
        public SlateContainer getSlate()
        {
            return slate;
        }
        public void playerBuyTriominoe()
        {
            countBoughtTriominoe++;
        }
        public void changeTurn()
        {
            setTurn(!turn);
            if (!turn)
                countBoughtTriominoe = 0;
        }
        public void pass()
        {
            addScore(-10);
        }

        public void setNumber(int nr)
        {
            number = nr;
        }
        public int getNumber()
        {
            return number;
        }
        public void setName(String n)
        {
            name = n;
            slate.setName(n);
        }
        public String getName()
        {
            return name;
        }
        public void setScore(int s)
        {
            score = s;
            slate.setScore(score);
        }
        public void addScore(int s)
        {
            score += s;
            slate.setScore(score);
        }
        public int getScore()
        {
            return score;
        }
        public void setRound(int r)
        {
            round = r;
            slate.setRound(r);
        }
        public int getRound()
        {
            return round;
        }
        public void setTurn(bool t)
        {
            slate.getPassBtn().isEnabled(false);
            turn = t;
            countBoughtTriominoe = 0;
        }
        public bool getTurn()
        {
            return turn;
        }
        public void setCountBoughtTriominoe(int c)
        {
            countBoughtTriominoe = c;
        }
        public int getCountBoughtTriominoe()
        {
            return countBoughtTriominoe;
        }
        public void Draw(GraphicsDevice graphics, SpriteBatch spriteBatch, SpriteFont triominoeFont, BasicEffect basicEffect)
        {
            slate.Draw(graphics, spriteBatch, triominoeFont, basicEffect, turn);
        }
    }
}
